#ifndef LOANDAT_H
#define LOANDAT_H
#include <vcl.h>
#include "LOAN.h"
#include "LoanItem.h"

class LoanDat
{   static const int ITEMNUM = 1000;
	private:

///////////////////////////////////from item list//////////////////////////////////////////////
	   double totalPrice;
	   AnsiString *loanIName[ITEMNUM];
		 //pointer to array storing the name of a certain item being loaned
	   int *loanAmt[ITEMNUM];
		 //pointer to array storing the amount of a certain item being loaned
	   double *Price[ITEMNUM];
		 //pointer to array storing the price of a certain item loaned
 //////////////////////////////////////////////////////////////////////////


 ///////////////////////////////from DB when checking/////////////////////////////////////////////
	   LoanItem *Items;
		 //LoanItem object storing all the item form database

	   AnsiString *retIName[ITEMNUM];
		 //pointer to array storing the name of a certain item being loaned
	   int *retLoanAmt[ITEMNUM];
		 //pointer to array storing the amount of a certain item being loaned
	   int *retRetAmt[ITEMNUM];
		 //pointer to array storing the amount of a certain item already returned
	   AnsiString VisName;
		 //storing a visitor name
	   double balance;
		 //storing a certain visitor's accbalance
///////////////////////////////////////////////////////////////////////////////////

	public:
	   LoanDat(int);
		  //The constructor get all item name, and price of the stand with stand ID from DB and put it in the list box of item list
	   bool checkSID(int);
		  //Checking whether it enters correct Stand ID by comparing it to the DB
	   void checkUID(int);
		  //Checking the UID, and show the data of the visitor from the DB
	   AnsiString getVisName();
		  //get the visitor name
	   double getBalance();
		  //get the visitor's balance
	   int searchItem(AnsiString nm);
		  //get the Item with the name nm and show it to the user
	   void addToCart(int i, int a);
		  //add the chosen item from the list to the array



	   AnsiString getLName(int);
		  //get the name of certain loaned item
	   int getLAmt(int);
		  //get amount of a certain loaned item
	   double ItemPriceLoaned(int index,int amount);
		  //calculate the price * amount of the item loaned / item
	   double getTotPrice();
		 //return the total price
	   void removeFromCart(int i, int a);
		 //decrease the amount of item index=i in cart box equal to a
		 //if the amount is 0, remove it from the cart



	   AnsiString getRetLoName();
		  //get the name of certain loaned item
	   int getRetLoAmt(int);
		  //get amount of a certain loaned item
	   int getRetAmt(int);
		  //get amount of a certain returned item




	   void loanDone();
		 //change the data in DB
	   void returnItem(int i, int a);
		 //modify the DB, the item at selected index and amount
	   void returnAll();
		 //modify the DB, returning all things loaned
	   void brokenItem(int i, int a);
		 //modify the DB, the item at selected index and amount
		 //considered returned, but amt available won't increase







};


#endif
